package com.java.grammer.equal.exer1;

/**
 * @author luzhikun
 * @date 2020/12/7- 17:00
 */
public class Circle extends GeometricObject {
    private double radius;

    public Circle() {

    }

    public Circle(double radius) {
        this.radius = radius;
    }

    public Circle(String color, double weight, double radius) {
        super(color, weight);
        this.radius = radius;
    }

    public void setRadius(double radius) {
        this.radius = radius;
    }

    public double getRadius() {
        return radius;
    }

    public double getArea(double radius) {
        return Math.PI * radius * radius;
    }

    public boolean equals(Object objects) {
        if (this == objects) {
            return true;
        }
        if (objects instanceof Circle) {
            Circle circle = (Circle) objects;
            if (this.radius == circle.radius) {
                return true;
            }
        }
        return false;
    }

    public String toString() {
        return "圆的半径为：" + radius;
    }

}

